﻿// -------------------------------------------------------------------------
//    @FileName         :    NFSignPart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFSignPart
//
// -------------------------------------------------------------------------

#include "NFSignPart.h"

#include "proto_cs_login.pb.h"
#include "proto_db.pb.h"

NFSignPart::NFSignPart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFSignPart::~NFSignPart()
{
}

int NFSignPart::CreateInit()
{
    return 0;
}
    
int NFSignPart::ResumeInit()
{
    return 0;
}

int NFSignPart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_play_data().sign_data());
    return 0;
}

int NFSignPart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    CHECK_NULL(0, pDbData);
    auto pSignData = pDbData->mutable_role_play_data()->mutable_sign_data();
    CHECK_NULL(0, pSignData);
    pSignData->add_sign_state( proto_ff::EN_SIGN_STATE_CAN_SIGN );
    pSignData->set_pay_sign_num(0);
    pSignData->set_last_sign_time( NF_ADJUST_TIMENOW() );
    pSignData->set_pay_count(0);
    pSignData->set_login_day(1);
    return 0;
}

int NFSignPart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_play_data()->mutable_sign_data());
    return 0;
}

int NFSignPart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    m_stData.ToPb(pCSGetRoleRsp->mutable_sign_data());
    return 0;
}

int NFSignPart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}
